<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="<%=path %>/statics/css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="../statics/css/loading.css"/>
    <link rel="stylesheet" type="text/css" href="../statics/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../statics/css/style.css"/>
      <script src="../statics/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
      <script  src="../statics/js/jquery-1.8.3.min.js" type="text/javascript"></script>
        <script  src="../statics/js/jquery-1.8.3.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../statics/css/wdgz.css">
     <link rel="stylesheet" href="<%=path %>/statics/css/sysz.css">
<style type="text/css">
button{
	width: 100%;
	min-height: 38px;
	margin:1% auto;
	border-width:0;
    border-radius:10px;
    outline-style: none;
    background:#1E90FF;
    line-height: 14px;
    font-size: 14px;
    color:#fff;
    

}
.dialog-container{
	width:100%;
	height: 100%;
	position: fixed;
	top:0;
	left: 0;
	display:-webkit-flex;
	-webkit-justify-content:center;
	-webkit-align-items:center;
	background:rgba(0,0,0,0.6);
}
.dialog-window{
	
	padding:2em 3em;
	border-width: 0;
	border-radius:10px;
	background:rgba(0,0,0,0.8);

}
.dialog-header{
	width: 50px;
	height: 50px;
	margin: 0 auto;
	border-width: 0;
	


}
.dialog-header.changeImage{
	width: 50px;
	height: 50px;
	margin: 0 auto;
	border-width: 0;
    animation:myHead 3s;
	-webkit-animation:myHead 3s;

}
@keyframes myHead{
	50%{
		background-size: 80px;
		width:80px;
		height: 80px;
	}
}
.dialog-header{
	


}
.dialog-header.ok{
	background:url(image/right.png);
	background-size:50px;
}
.dialog-header.loading{
	background:url(image/loading.gif);
	background-size:50px;
}
.dialog-header.warning{
	background:url(image/ico.ooopic.png);
	background-size:50px;
}
.dialog-content{
	text-align: center;
	padding: 1em;
	color:#666;
	line-height: 200%;
	font-size:14px;
}
.dialog-footer{
    width: auto;
	padding: 0 0.6em;
	display:-webkit-flex;
	-webkit-justify-content:center;
	-webkit-align-items:center;

}
.dialog-footer button{
	display: inline-block;
	-webkit-appearance:normal;
	border-radius: 5px;
	margin:0 0.4em;
	padding: 0.2em 0.8em;
	font-size: 14px;
	

}
.dialog-footer button.red{
	background:red;
}
.dialog-footer button.blue{
	background:#01A2A2;
}
</style>
<script type="text/javascript" src="<%=path %>/statics/js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="<%=path %>/statics/js/alertPopShow.js"></script>
   
       
    <script type="text/javascript">
    	$(window).load(function(){
    		$(".loading").addClass("loader-chanage")
    		$(".loading").fadeOut(300)
    	})
    </script>
    
    <script type="text/javascript">
    function getRootPath(){
    //获取当前网址，如： http://localhost:8083/uimcardprj/share/meun.jsp
    var curWwwPath=window.document.location.href;
    //获取主机地址之后的目录，如： uimcardprj/share/meun.jsp
    var pathName=window.document.location.pathname;
    var pos=curWwwPath.indexOf(pathName);
    //获取主机地址，如： http://localhost:8083
    var localhostPaht=curWwwPath.substring(0,pos);
    //获取带"/"的项目名，如：/uimcardprj
    var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
    return(localhostPaht+projectName);
}

    	function btnden() {
    	var phone = document.getElementById("phone").value;
    	var password =document.getElementById("password").value;
    	$.ajax({
				type:"post",
				url:getRootPath()+"/user/login.html",

				data:{phone:phone,password:password},

				dataType:"json",
				success:function(data){
				if(data=="账号不存在"){
				        webToast("账号不存在","middle",1000);
				return;
				}
				if(data=="密码错误")
				{
				   
                webToast("账号或密码错误","middle",1000);
				return;
				}
				
					if(data != null){
					
						location.href =getRootPath()+data;
						
					}
				},
				error:function(data){
alert(1);
					
				}
			});
			
		}
		
		
	function dels() {
	 var phoneReg=/^1[13578]\d{9}$/;
            var pwdReg = /^[a-zA-Z]\w{5,17}$/;
		 var loginPhone = $("#phone").val().length;
             var loginPwd = $("#password").val().length;
             if(loginPhone===0){
                 webToast("输入的手机号码不正确","middle",1000);
                 return;
             } else if(!phoneReg.test($("#phone").val())){
                     
            webToast("输入的手机号码不正确","middle",1000);
                     return ;
             } else if(loginPhone!==0&&loginPwd===0){
                 
                   webToast("请输入密码","middle",1000);
                 reutrn;
             } else if(!pwdReg.test($("#password").val())){
               
                 webToast("密码格式不正确","middle",1000);
                 return;
             }
             btnden();
	}
            
		
    </script>
</head>
<!--loading页开始-->
<div class="loading">
	<div class="loader">
	
	
        <div class="loader-inner pacman">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
	</div>
</div>
<!--loading页结束-->
<body>
	
	<header class="top-header">
		<a class="text texta" href="<%=path %>/index.html">取消</a>
		<h3>登录</h3>
		<a class="text" href="<%=path %>/user/zhu.html">注册</a>
	</header>

	<div class="login">

		<form>
			<ul>
				<li>
					<img src="../statics/images/login.png"/>
					<label>账号</label>
					<input type="text" name="phone" id="phone" placeholder="请输入账号"/>
				</li>
				<li>
					<img src="../statics/images/password.png"/>
					<label>密码</label>
					<input type="password" name="password" id="password" placeholder="请输入密码"/>
				</li>
					<li>
					<a style="float: right;   " href="<%=path %>/user/newPassword.html">忘记密码</a>
				</li>
			</ul>
			<input type="button" id="dengluBtn" onclick="dels();" value="登录"/>
			
		</form>
	</div>

<div class="x-qtip" style="display: none;"><div class="x-qtip-body"><div class="x-qtip-icon"><i></i></div><div class="x-qtip-msg">请输入手机号码</div></div></div>	
</body>
</html>